﻿using LZHDemo.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace LZHDemo.Controllers
{
    public class LZHController : Controller
    {
        private SchoolEntities _context;
        public LZHController()
        {
            _context = new SchoolEntities();

        }
        // GET: LZH
        public ActionResult Index()
        {
            ViewBag.DaDemo = _context.People.ToList();
            return View();
        }
        public ActionResult ADD()
        {

            return View();
        }
        [HttpPost]
        public void Save(Person person)
        {
            
            _context.People.Add(person);
            
           var   result= _context.SaveChanges();

            if (result>0)
            {
                Response.Redirect("Index");
            }
        }
    }
}